#include <iostream>
using namespace std;
int main()
{
	int i = 1, a;
	for (i; i <= 1000; i++)
	{
		a = i * i;
		if (i == (a % 10) || i == (a % 100)||i==(a%1000))
			cout << i << "," << a << endl;

	}
	return 0;
}